<template>
	<view class="spread-order">
		<view class="content">
			<view class="order-container">
				<view v-for="(item, index) in lists" :key="item.order_sn" class="order-item bg-white mt20">
					<view class="order-header row-between">
						<view class="muted">订单编号:{{item.order_sn}}</view>
						<view class="row">
							<template>
								<view class="mr10">租赁订单</view>
							</template>
							<view class="order-sign--goods">预约单</view>
						</view>
					</view>
					<view class="order-content row">
						<view class="order-goods-img">
							<u-image width="100%" height="100%" :src="item.image" />
						</view>
						<view class="order-goods-info ml20">
							<view class="row-between">
								<view class="name row bold">用户姓名</view>
								<view class="address">广州天河区广场网点</view>
							</view>


							<view class="phone-row">
								<image src="../../static/images/icon_7.png" mode="widthFix" class="icon1"></image>
								<text class="text">16938827749</text>
								<image src="../../static/images/icon_6.png" mode="widthFix" class="icon2"></image>
							</view>
						</view>

					</view>

					<view class="goods-info-box">
						<view class="content-box">
							<view class="row-between">
								<view class="left row">
									<view class="label">产品：</view>
									<view class="text">Iphone 15pro</view>
								</view>
								<view class="right">租期：3天</view>
							</view>
							<view class="date">下单时间：2024.02.15 15:30:35</view>
						</view>
					</view>
					<view class="address-box">
						<view class="row">
							<view class="dot"></view>
							<view class="label">配送地址：</view>
							<view class="text">宋海星 13711486881</view>
						</view>
						<view class="address">广州·东湖南路中国科</view>
					</view>
				</view>
				<loading-footer slotEmpty :status="loadingStatus">
					<view slot="empty" class="data-null column-center">
						<image class="img-null" src="/static/images/news_null.png"></image>
						<text class="sm muted">暂无订单～</text>
					</view>
				</loading-footer>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		agentOrderIds
	} from "@/utils/type";
	import {
		loadingType
	} from "@/utils/type";
	import {
		getPromoteOrder
	} from "@/api/user";
	import {
		loadingFun
	} from '@/utils/tools'

	export default {
		data() {
			return {
				lists: [{}],
				page: 1,
				loadingStatus: loadingType.LOADING,
				confirmDialog: false
			};
		},

		components: {},
		props: {
			type: {
				type: Number | String,
				default: agentOrderIds.ALL
			}
		},

		created() {
			this.$on('RESET_LIST', this.reflesh, this);
		},

		beforeMount() {
			this.getPromoteOrderFun(); // this.$getAfterSaleList()
		},

		methods: {
			reflesh() {
				this.page = 1;
				this.lists = [];
				this.loadingStatus = loadingType.LOADING; // this.$getAfterSaleList();
			},

			getPromoteOrderFun() {
				let {
					loadingStatus,
					lists,
					page
				} = this;
				loadingFun(getPromoteOrder, page, lists, loadingStatus, {
					status: this.type
				}).then(res => {
					if (res) {
						this.page = res.page;
						// this.lists = res.dataList
						this.loadingStatus = res.status
					}
				})
			},

			// 获取金额标签
			getMoneyLabel(index) {
				switch (index) {
					case 0:
						return '金额';
					case 1:
						return '金额';
					case 2:
						return '质检价';
					case 3:
						return '金额';
				}
			},

		}
	};
</script>
<style lang="scss">
	@import "index.scss";
</style>